using Microsoft.Win32.SafeHandles;

namespace Be.Timvw.Framework.Win32.SafeHandles
{
    public class SafeTokenHandle : SafeHandleZeroOrMinusOneIsInvalid
    {
        protected internal SafeTokenHandle()
        : base(true)
        {
        }

        protected override bool ReleaseHandle()
        {
            if(!this.IsInvalid)
            {
                return NativeMethods.CloseHandle(this.handle);
            }

            return true;
        }
    }
}